home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / jazlib.arc / JZDELAY.C < prev    next >
Text File  |  1988-12-18  |  1KB  |  30 lines

  1. /*
  2. ┌────────────────────────────────────────────────────────────────────────────┐
  3. │jzdelay.c                                                                   │
  4. │Hold the program in a wait state for the specified number of clock tics.    │
  5. │Note that this is NOT tied to processor speed.                              │
  6. │                                                                            │
  7. │Notes: there are approx 18.2 tics a second.                                 │
  8. │                                                                            │
  9. │ (C) JazSoft Software by Jack A. Zucker (301) 794-5950                      │
  10. └────────────────────────────────────────────────────────────────────────────┘
  11. */
  12.  
  13. jzdelay(ftics)
  14. long ftics;
  15. {
  16.    long wstart;         /* hold the starting time */
  17.    long welapse;        /* count of elapsed tics  */
  18.    union REGS sreg,dreg;
  19.  
  20.    sreg.x.ax = 0;        /* return timer count function */
  21.    int86(0x1A,&sreg,&dreg);
  22.    wstart = (long) (dreg.x.cx << 16) | dreg.x.dx;
  23.    welapse = 0;
  24.    while (ftics > welapse) {
  25.      sreg.x.ax = 0;        /* return timer count function */
  26.      int86(0x1A,&sreg,&dreg);
  27.      welapse = ((long) (dreg.x.cx << 16) | dreg.x.dx) - wstart;
  28.    }
  29. }
  30.